#include "caidan1button.h"
#include "ui_caidan1button.h"

Caidan1Button::Caidan1Button ( QWidget* parent ) :
    QQtClickWidget ( parent ),
    ui ( new Ui::Caidan1Button )
{
    ui->setupUi ( this );
}

Caidan1Button::Caidan1Button ( const Caidan1Button& other )
{
    *this = other;
}

Caidan1Button::~Caidan1Button()
{
    delete ui;
}

Caidan1Button& Caidan1Button::operator = ( const Caidan1Button& other )
{
    mLightNo = other.lightNo();
    mSceneName = other.sceneName();
    mSceneIcon = other.sceneIcon();
    return *this;
}

bool Caidan1Button::operator == ( const Caidan1Button& other )
{
    if ( mLightNo == other.lightNo() )
        return true;

    return false;
}

int Caidan1Button::lightNo() const { return mLightNo; }

QString Caidan1Button::sceneName() const { return mSceneName; }

QString Caidan1Button::sceneIcon() const { return mSceneIcon; }

int& Caidan1Button::lightNo() { return mLightNo; }

QString& Caidan1Button::sceneName() { return mSceneName; }

QString& Caidan1Button::sceneIcon() { return mSceneIcon; }

void Caidan1Button::setTextFont ( QFont font )
{
    ui->label->setFont ( font );
    ui->label->setFixedHeight ( ui->label->fontMetrics().height() );
    update();
}

void Caidan1Button::setTextFont2 ( QFont font )
{
    ui->widget->setTextFont ( font );
}

void Caidan1Button::setIconSize ( QSize size )
{
    ui->widget->setFixedSize ( size );
    update();
}

void Caidan1Button::setIconSize2 ( QSize size )
{
    ui->widget->setIconSize ( size );
}

QSize Caidan1Button::iconSize()
{
    return ui->widget->size();
}

QSize Caidan1Button::iconSize2()
{
    return ui->widget->iconSize();
}

void Caidan1Button::updateWidget()
{
    ui->widget->setIcon ( mSceneIcon );
    ui->widget->setText ( QString::number ( mLightNo ) );
    ui->label->setText ( mSceneName );
    update();
}
